import {request,reuqestMock} from  "@/utils/http/index"
export const requestCategoryList =()=>{
    return request.get("/api/product/getBaseCategoryList")
} 
//mock banner mock 数据拦截
export const requestBannerList=()=>{
    return reuqestMock.get("/banner")
}
//mock floor  mock 数据拦截

export const requestFloorList=()=>{
    return reuqestMock.get("/floor")
}
//请求list
export const requestSearchList =(params)=>{
    return request.post("/api/list",params)
} 
//请求datail数据
export const requestDetailInfo =(skuId)=>{
    return request.get(`/api/item/${skuId}`)
} 

//发送购物车请求
export const requestAddOrUpdataNumCart =({skuId,skuNum})=>{
    return request.post(`/api/cart/addToCart/${skuId}/${skuNum}`)
} 

//获取购物车列表
export const requestShopCart = () => {
    return request.get(`/api/cart/cartList`);
  };

  //修改购物车单选框
  export const requestUpdateSingleCheck =({ skuId, isChecked })=>{
    return request.get(`/api/cart/checkCart/${skuId}/${isChecked}`)
  }
//修改所有购物车商品的选中状态
export const requestUpdateAllCheck = (isChecked, skuIdList) => {
    return request.post(`/api/cart/batchCheckCart/${isChecked}`, skuIdList);
  };
  //删除购物车单个商品
export const requestDeleteSingleGood = (skuId) => {
    return request.delete(`/api/cart/deleteCart/${skuId}`);
  };
//删除所有选项
  export const requestDeleteAllGoods = (skuIdList) => {
    return request.delete(`/api/cart/batchDeleteCart`, {
      data: skuIdList,
    });
  };
//验证码请求
export const getRegisterCode=(phone)=>{
    return request.get(`/api/user/passport/sendCode/${phone}`);
}
//注册请求
export const requestRegister =(registerInfo)=>{
    return request.post(`/api/user/passport/register`,registerInfo)
}
//登录请求
export const requestLogin = (userInfo) => {
  return request.post("/api/user/passport/login", userInfo);
};
//登录以后获取用户信息
export const requestUserInfo = () => {
  return request.get("/api/user/passport/auth/getUserInfo");
};
//退出登录
export const requestLogout = () => {
  return request.get("/api/user/passport/logout");
};
//交易页数获取
export const requestTradeInfo =()=>{
  return request.get("/api/order/auth/trade");
}
//请求购物车地址
export const requestTradeAddress = () => {
  return reuqestMock.get("/address");
};
//提交订单
export const requestAddTrade = (tradeNo, tradeInfo)=>{
  return request.post(`/api/order/auth/submitOrder?tradeNo=${tradeNo}`,tradeInfo)
}
//点击支付发送  生成二维码支付
export const requestPatDetail = (orderId)=>{
  return request.get(`/api/payment/weixin/createNative/${orderId}`)
}
//查看某个订单编号的支付状态
export const reuqestPayStatus = (orderId)=>{
  return request.get(`/api/payment/weixin/queryPayStatus/${orderId}`);
}
//请求个人中心数据
export const requestOrderList =({page, limit})=>{
  return request.get(`/api/order/auth/${page}/${limit}`);
}